﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;

namespace WcfBLService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        MyVideoClass GetVideoById(int video_id);

        [OperationContract]
        bool SaveVideoToDB(VideoClass video);

        [OperationContract]
        bool DeleteVideoById(int id);

        [OperationContract]
        bool UpdateVideoById(int id, string name, byte[] videoStream, byte[] imageStream);

        [OperationContract]
        ListViewClass GetAllThumbnailVideoAvailable();

        [OperationContract]
        List<MyBannerClass> GetAllBannersForVudeo(int id);

        [OperationContract]
        void SaveVideoToServiceEnvironment(VideoClass video);


        // TODO: Add your service operations here
    }

    // Use a data contract as illustrated in the sample below to add composite types to service operations

    [DataContract]
    public class ListViewItemClass
    {   
        /// <summary>
        ///  the Thumbnail of each movie in DB-Contract
        /// </summary>
        [DataMember]
        public int id { get; set; }

        [DataMember]
        public byte[] smallImageByte { get; set; }

        [DataMember]
        public string name { get; set; }
    }

    [DataContract]
    public class ListViewClass
    {
        /// <summary>
        /// list of Thumbnails
        /// </summary>
        //[DataMember]
        //public List<ListViewItemClass> ListViewItems { get; set; } 

        [DataMember]
        public List<ThumbnailClass> ListViewItems { get; set; }
    }

    [DataContract]
    public class ThumbnailClass
    {
        /// <summary>
        ///  the new Thumbnail representation of each movie in DB-Contract
        /// </summary>
        [DataMember]
        public int id { get; set; }

        [DataMember]
        public string imageUrl { get; set; } 

        [DataMember]
        public string name { get; set; }
    }

    [DataContract]
    public class MyBannerClass
    {
        /// <summary>
        /// the new Banner representation for the client 
        /// </summary>
        [DataMember]
        public string bannerUrl { get; set; }

        [DataMember]
        public int bannerSize { get; set; }

        [DataMember]
        public int bannerTime { get; set; } 
    }

    [DataContract]
    public class MyVideoClass
    {
        /// <summary>
        /// the new Video representation for the client
        /// </summary>
        [DataMember]
        public string videoUrl { get; set; } 

        [DataMember]
        public List<MyBannerClass> banners { get; set; }
    } 

    [DataContract]
    public class BannerClass
    {
        /// <summary>
        /// Banner representation for the client
        /// </summary>
        [DataMember]
        public byte[] bannerContent { get; set; }

        [DataMember]
        public int bannerSize { get; set; }

        [DataMember]
        public int bannerTime { get; set; } 
    }

    [DataContract]
    public class VideoClass
    {
        /// <summary>
        /// Video representation for the client
        /// </summary>
        [DataMember]
        public byte[] videoByte { get; set; }

        [DataMember]
        public List<BannerClass> banners { get; set; }
    }
}
